﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace PeisongWeb.admin
{
    public partial class systemError : adminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (hasPermission("HC", 1))
                {
                   
                    rptBind();
                }
                else
                {
                    Library.Script.ClientMsgUrl("没有权限！", "index.aspx");
                    return;
                }
               
                
            }
        }

        void rptBind()
        {


            string where = "1=1";
            DataSet ds = logic.sysLog.getList(where, "slId desc", AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex);
            AspNetPager1.RecordCount = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
            rpt_list.DataSource = ds.Tables[1];
            rpt_list.DataBind();

        }

        protected void ibt_search_Click(object sender, ImageClickEventArgs e)
        {
            rptBind();
        }
        protected void rpt_list_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int slid = Convert.ToInt32(e.CommandArgument);
            getDetail(slid);
            errorDetails.Show();
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            rptBind();
        }

        void getDetail(int slid)
        {
            logic.sysLog.setView(slid);
            DataRow dr = logic.sysLog.selectByID(slid);
            if (dr != null)
            {
                lbl_id.Text = dr["slid"].ToString();
                lbl_dt.Text = Library.DateTimeLib.DtConvert2(dr["sldt"].ToString());
                lbl_severity.Text = dr["slserverity"].ToString();
                lbl_exigence.Text = dr["slEmergency"].ToString();
                hyp_url.NavigateUrl = dr["slurl"].ToString();
                lbl_ip.Text = dr["slip"].ToString();
                lbl_user.Text = dr["userEmail"].ToString();
                lbl_infor.Text = dr["slInfor"].ToString();
                lbl_suggest.Text = dr["suggest"].ToString();
            }
        }
    }
}
